package com.scenic.rd_android;

import com.nova.scenic.projectlibs.util.debug.MyLog;

import org.hamcrest.Matcher;
import org.junit.Assert;

/**
 * Created by scenic on 2016/8/25.
 */
public class BaseTestClass {
    private MyLog myLog = null;

    public BaseTestClass(){
        myLog = MyLog.buildForJava(this.getClass());
        myLog.setPattern(MyLog.PATTERN_ALL);

    }



    private MyLog.StackTraceRange range1 = new MyLog.StackTraceRange() {
        @Override
        public int getStart() {
            return MyLog.STACK_TRACE_RANGE_JAVA.getStart() + 1;
        }

        @Override
        public int size() {
            return MyLog.STACK_TRACE_RANGE_JAVA.size();
        }
    };

    public void log(Object object){
        myLog.setStackTraceRange(range1);
        myLog.info(object);
    }

    public <T> void assertThat(T actual, Matcher<? super T> matcher) {
        myLog.setStackTraceRange(range1);
        myLog.info(actual);
        Assert.assertThat(actual,matcher);
    }

}
